
<%@ page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html >
<html>
<head>
<base href="${base}/" />
<title>后台管理</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/admin.css" />
<%--<script type="text/javascript" src="js/jquery-2.0.3.js"></script>--%>
	<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery-3.7.1.min.js"></script>
<script type="text/javascript">

	
function update(id,account,name){
	document.getElementById("update").style.display =  "block"
	document.getElementById("overlay").style.display = "block";
	document.getElementById("id").value=id
	document.getElementById("account").value=account
	document.getElementById("username").value=name
}

function off(){
	document.getElementById("update").style.display =  "none"
	document.getElementById("add").style.display =  "none"
	document.getElementById("overlay").style.display = "none";

}

function add(){
	document.getElementById("add").style.display = "block"
}


setTimeout(function() {
	document.getElementById('tempMsg').style.display = 'none';
}, 2000);



</script>
</head>
<div id="overlay" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 999;"></div>
<body style="position: relative;">

	<div class="container" style="height: 1000px;width: 100%">
		<div id="header">
			<div class="logo">
				<a href=""><img src="shop/static/images/admin/logo.png" width="303" height="43" /></a>
			</div>
			<p>
				<a href="/shop/index">退出管理</a> <a href="/shop/admin/">后台首页</a> <a href="/shop/index" target='_blank'>商城首页</a>
				<span>您好 <label class='bold'>${sessionScope.manager.account}</label></span>
			</p>
		</div>
		<div id="admin_left" >
			<ul class="submenu">
				<ul class="menu">

					<li><a href="shop/admin/category/add">增加类别</a></li>
					<li><a href="shop/admin/category/list">类别列表</a></li>
					<li><a href="shop/goods/add">增加商品</a></li>
					<li><a href="shop/admin/user/list">用户列表</a></li>
					<li><a href="shop/admin/admin/list">管理员列表</a></li>
					<li><a href="shop/admin/goods/list">商品列表</a></li>
				</ul>
			</ul>
			<div id="copyright"></div>
		</div>

		<div id="admin_right">
			<div class="headbar">
				<div class="field">
					<table class="list_table">
						<col width="50px" />
						<col width="100px" />
						<col width="100px"/>
						<col width="100px"/>
						<thead>
							<tr>
								<th>序号</th>
								<th>名称</th>
								<th>电话</th>
								<th>操作</th>

								<th><button onclick="add()" style="background-color: green;color: #ebebeb">新增管理员</button></th>
							</tr>
						</thead>
					</table>
				</div>
			</div>

			<div class="content">
				<table id="list_table" class="list_table">
						<col width="50px" />
						<col width="100px" />
						<col width="100px"/>
					<tbody>
					<c:forEach items="${adminList}" var="admin" varStatus="s">
						<tr>
						    <td>${s.count}</td>
							<td>${admin.username}</td>
							<td>${admin.phone}</td>
							<td>
								<button onclick="update(${admin.id},`${admin.phone}`,`${admin.username}`)"> 修改</button>

								<button> <a href="/shop/admin/admin/delete?id=${admin.id}">删除</a></button>
							</td>
						</tr>
						</c:forEach>
					</tbody>
				</table>
			</div>
			<c:if test="${msg!=null}">
				<div  class="meg" id="tempMsg" style="margin-left: 50px">
					<h2 style="color: red">${msg}</h2>
				</div>
			</c:if>
		</div>

		<div id="separator"></div>
	</div>



	<div id="update" style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); display: none; border: 1px solid #b9b9b9; background: white; padding: 20px; z-index: 1000;">

		<form action="/shop/admin/admin/update" method="post">
			<input name="id" id="id" type="hidden">
			<label>用户名:</label>
			<input name="username" id="username">
			<label>电话:</label>
			<input name="account" id="account">

			<div style="margin-top: 10px;margin-left: 80px">
				<button type="submit">确定</button>
				<button type="button" onclick="off()">取消</button>
			</div>
		</form>

	</div>

	<div id="add" style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); display: none; border: 1px solid #b9b9b9; background: white; padding: 20px; z-index: 1000;">

		<form action="/shop/admin/admin/add" method="post">
			<label>手机号</label>
			<input name="account" >

			<div style="margin-top: 10px;margin-left: 80px">
				<button type="submit">确定</button>
				<button type="button" onclick="off()">取消</button>
			</div>
		</form>
	</div>
</body>
</html>
